package ch8.unidirectionalToBidirectional;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;

public class Order {
    private Customer _customer;

    void addCustomer(Customer arg){
        arg.frindOrders().add(this);
        this._customer.frindOrders().add(this);
    }

    void removeCustomer(Customer arg){
        arg.frindOrders().remove(this);
    }

    public Customer getCustomer() {
        return this._customer;
    }

    public void setCustomer(Customer arg) {
        arg.frindOrders().remove(this);
        this._customer.frindOrders().remove(arg);
    }

    public static void main(String[] args){
        List list = new ArrayList();
        list.add(1);
        list.add(null);
        list.add(2);
        System.out.println(list);
        list.removeAll(Collections.singleton(null));
        System.out.println(list);

    }

}
